package tuyou;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.jws.WebService;

import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

@WebService
public class JaxwsService {

	public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyy-MM-dd hh:mm:ss");
	
	public String sayHello(String name){
		
		System.out.println("sayHello...name:" + name);
		return DATE_FORMAT.format(new Date()) + " hello " + name;
	}
	
	public static void main(String[] args) {
		
		JaxWsServerFactoryBean bean = new JaxWsServerFactoryBean();
		
		bean.setAddress("http://localhost:9999/HelloService");
		bean.setServiceClass(JaxwsService.class);
		bean.setServiceBean(new JaxwsService());
		bean.create();
		System.out.println("server ready...");
	}
}
